import { Link } from 'react-router-dom';
// import routes from "@/router/routes"
import { Breadcrumb } from 'antd';
import { Fragment } from 'react';
import BreadcrumbItem from 'antd/es/breadcrumb/BreadcrumbItem';

const BreadCrumbBase = () => {
  // 定义数据的类型
  interface Route {
    path: string;
    breadcrumbName: string;
    children?: Array<{
      path: string;
      breadcrumbName: string;
    }>;
  }

  // 匹配主页中的子页面
  // let target = routes.find(item => item.path === '/')

  //     let circleBreadCrumb = (data:any) => {

  //         let breadcrumbList:Route[] = []

  //         data.length && data.forEach((item:any) => {

  //             // 获取routes中元素的label以及path属性
  //             let obj:Route = {
  //                 breadcrumbName:item.breadcrumbName,
  //                 path:item.path,
  //             }
  //             // 有children的情况下
  //             if(item.children){
  //                 // item.children.forEach((item:any) => {
  //                 //   console.log(item)
  //                 //   obj.children!.label = item.label
  //                 //   obj.children!.path = item.path
  //                 // })
  //                 obj.children = circleBreadCrumb(item.children)
  //             }
  //             breadcrumbList.push(obj)
  //         })

  //         return breadcrumbList
  //     }

  // let breadcrumbList = circleBreadCrumb(target!.children)
  // console.log(breadcrumbList)

  // const breadCrumb = breadcrumbList.map((item:any,index:any)=>{

  //     console.log(item.children)
  //     if(!item.chiidren){
  //         return <Breadcrumb.Item href={'/'+item.path}>
  //                     {item.breadcrumbName}
  //                 </Breadcrumb.Item>
  //     }else{
  //         item.children.forEach((current:any)=>{
  //             return <Breadcrumb.Item href={'/'+item.path+'/'+current.path}>
  //                         {item.breadcrumbName+current.breadcrumbName}
  //                     </Breadcrumb.Item>
  //         })

  //     }

  // })

  return (
    <Breadcrumb>
      <Breadcrumb.Item href="/">主页</Breadcrumb.Item>
      {/* {breadCrumb} */}

      {/* {
                breadcrumbList.map((item:any,index:any)=>{

                        // console.log(item.children)
                        if(!item.chiidren){
                            return <Breadcrumb.Item key={index} href={'/'+item.path}>
                                        {item.breadcrumbName}
                                    </Breadcrumb.Item>
                        }else{
                            // item.children.forEach((current:any,id:any)=>{
                            //     return <Breadcrumb.Item key={id} href={'/'+item.path+'/'+current.path}>
                            //                 {item.breadcrumbName+current.breadcrumbName}
                            //             </Breadcrumb.Item>
                            // })
                            
                        }
                            
                        
                        
                    })
            } */}
    </Breadcrumb>
  );
};

export default BreadCrumbBase;
